package com.celestial.Controller;

import com.celestial.Domain.DTO.PackageLabel;
import com.celestial.Domain.VO.Result;
import com.celestial.Domain.VO.Triple;
import com.celestial.Service.Neo4jService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
public class Neo4jController {

    private Neo4jService neo4jService;

    public Neo4jController(Neo4jService neo4jService) {
        this.neo4jService = neo4jService;
    }


    @GetMapping("/getAllLabels")
    public Result getAllLabels(){
        log.info("获取所有标签");
        List<PackageLabel> allLabels = neo4jService.getAllLabels();
        return Result.success(allLabels);
    }

    @GetMapping("/getConferenceGraph")
    public Result getConferenceGraph(){
        log.info("获取会议结点子图");
        List<Triple> conferenceGraph = neo4jService.getConferenceGraph();
        return Result.success(conferenceGraph);
    }

    @GetMapping("/getPersonGraph")
    public Result getPersonGraph(){
        log.info("获取人物结点子图");
        List<Triple> personGraph = neo4jService.getPersonGraph();
        return Result.success(personGraph);
    }

    @GetMapping("/getInstituteGraph")
    public Result getInstituteGraph(){
        log.info("获取机构结点子图");
        List<Triple> instituteGraph = neo4jService.getInstituteGraph();
        return Result.success(instituteGraph);
    }

    @GetMapping("/getPolicyGraph")
    public Result getPolicyGraph(){
        log.info("获取政策结点子图");
        List<Triple> policyGraph = neo4jService.getPolicyGraph();
        return Result.success(policyGraph);
    }

    @GetMapping("/getDocumentGraph")
    public Result getDocumentGraph(){
        log.info("获取文件子图");
        List<Triple> documentGraph = neo4jService.getDocumentGraph();
        return Result.success(documentGraph);
    }

    @GetMapping("/getMeasurementGraph")
    public Result getMeasurementGraph(){
        log.info("获取措施子图");
        List<Triple> measurementGraph = neo4jService.getMeasurementGraph();
        return Result.success(measurementGraph);
    }

    @GetMapping("/getRegionGraph")
    public Result getRegionGraph(){
        log.info("获取地区子图");
        List<Triple> regionGraph = neo4jService.getRegionGraph();
        return Result.success(regionGraph);
    }

}
